/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Marcio
 */
@Entity
@Table(name = "SGUF")
@NamedQueries({
    @NamedQuery(name = "Sguf.findAll", query = "SELECT s FROM Sguf s"),
    @NamedQuery(name = "Sguf.findByNomeUf", query = "SELECT s FROM Sguf s WHERE s.nomeuf = :nomeuf")})
public class Sguf implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SgufPK sgufPK;
    @Basic(optional = false)
    @Column(name = "NOMEUF")
    private String nomeuf;
    @Basic(optional = false)
    @Column(name = "CODUF")
    private short coduf;
    @Basic(optional = false)
    @Column(name = "REGIAOUF")
    private String regiaouf;
    @Basic(optional = false)
    @Column(name = "DTINS")
    @Temporal(TemporalType.DATE)
    private Date dtins;
    @Basic(optional = false)
    @Column(name = "HINS")
    @Temporal(TemporalType.TIME)
    private Date hins;
    @Basic(optional = false)
    @Column(name = "IDUSUINS")
    private String idusuins;
    @Column(name = "DTALT")
    @Temporal(TemporalType.DATE)
    private Date dtalt;
    @Column(name = "HALT")
    @Temporal(TemporalType.TIME)
    private Date halt;
    @Column(name = "IDUSUALT")
    private String idusualt;
    @JoinColumn(name = "CODPAIS", referencedColumnName = "CODPAIS", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Sgpais sgpais;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sguf")
    private Collection<Sgmunicipio> sgmunicipioCollection;

    public Sguf() {
    }

    public Sguf(SgufPK sgufPK) {
        this.sgufPK = sgufPK;
    }

    public Sguf(SgufPK sgufPK, String nomeuf, short coduf, String regiaouf, Date dtins, Date hins, String idusuins) {
        this.sgufPK = sgufPK;
        this.nomeuf = nomeuf;
        this.coduf = coduf;
        this.regiaouf = regiaouf;
        this.dtins = dtins;
        this.hins = hins;
        this.idusuins = idusuins;
    }

    public Sguf(String siglauf, short codpais) {
        this.sgufPK = new SgufPK(siglauf, codpais);
    }

    public SgufPK getSgufPK() {
        return sgufPK;
    }

    public void setSgufPK(SgufPK sgufPK) {
        this.sgufPK = sgufPK;
    }

    public String getNomeuf() {
        return nomeuf;
    }

    public void setNomeuf(String nomeuf) {
        this.nomeuf = nomeuf;
    }

    public short getCoduf() {
        return coduf;
    }

    public void setCoduf(short coduf) {
        this.coduf = coduf;
    }

    public String getRegiaouf() {
        return regiaouf;
    }

    public void setRegiaouf(String regiaouf) {
        this.regiaouf = regiaouf;
    }

    public Date getDtins() {
        return dtins;
    }

    public void setDtins(Date dtins) {
        this.dtins = dtins;
    }

    public Date getHins() {
        return hins;
    }

    public void setHins(Date hins) {
        this.hins = hins;
    }

    public String getIdusuins() {
        return idusuins;
    }

    public void setIdusuins(String idusuins) {
        this.idusuins = idusuins;
    }

    public Date getDtalt() {
        return dtalt;
    }

    public void setDtalt(Date dtalt) {
        this.dtalt = dtalt;
    }

    public Date getHalt() {
        return halt;
    }

    public void setHalt(Date halt) {
        this.halt = halt;
    }

    public String getIdusualt() {
        return idusualt;
    }

    public void setIdusualt(String idusualt) {
        this.idusualt = idusualt;
    }

    public Sgpais getSgpais() {
        return sgpais;
    }

    public void setSgpais(Sgpais sgpais) {
        this.sgpais = sgpais;
    }

    public Collection<Sgmunicipio> getSgmunicipioCollection() {
        return sgmunicipioCollection;
    }

    public void setSgmunicipioCollection(Collection<Sgmunicipio> sgmunicipioCollection) {
        this.sgmunicipioCollection = sgmunicipioCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sgufPK != null ? sgufPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sguf)) {
            return false;
        }
        Sguf other = (Sguf) object;
        if ((this.sgufPK == null && other.sgufPK != null) || (this.sgufPK != null && !this.sgufPK.equals(other.sgufPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Sguf[ sgufPK=" + sgufPK + " ]";
    }
    
}
